/*
 * Copyright (c) 2015—2030 GantSoftware.Co.Ltd. All rights reserved.
 * <p>
 * Unless required by applicable law or agreed to in writing, software
 * is not allowed to be distributed or copied without the license from
 * GantSoftware.Co.Ltd. Please contact the company for more information.
 */
package com.gantang.gax.service.impl;

import com.gantang.gax.dto.bool.BoolFeatureTable;
import com.gantang.gax.engine.service.LogicEngineService;
import com.gantang.gax.service.BoolFeatureTableService;
import com.gantang.gax.service.LogicDeductionService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigInteger;
import java.util.List;

@Slf4j
@Service("logicDeductionService")
public class LogicDeductionServiceImpl implements LogicDeductionService {
    @Autowired
    private BoolFeatureTableService logicBoolFeatureTableService;

    @Override
    public List<String> doGetRecommendCombination(BoolFeatureTable featureTable) {
        //实际可能通过taskId从缓存获取
        LogicEngineService engine = (LogicEngineService) logicBoolFeatureTableService.doUpsertFeatureTable(featureTable);
        BigInteger solutionCount = engine.solutionCount2();
        log.info("solutionCount:{}", solutionCount);
        return engine.findBestSolution();
    }
}
